<!--  -->
<template>
  <div class="register">
    <div class="Jump_div">
      <span class="Jump_span" @click="login">先看看，跳过 &gt;</span>
    </div>
    <div class="Come_use">
      <h2>欢迎来到电商App</h2>
    </div>

    <div class="input_item">
      <van-form>
        <div class="input_title">手机号码</div>
        <van-field
          class="inpu—cell"
          v-model="username"
          name="username"
          label="+86"
          label-width="50px"
          placeholder="请输入手机号"
        />

        <van-field
          v-model="password"
          center
          name="password"
          label="验证码"
          label-width="50px"
          placeholder="请输入验证码"
        >
          <template #button>
            <van-button size="small" type="primary" @click="Resend">
              <van-count-down
                :time="time"
                format="sss"
                ref="CountDown"
                style="display: none"
                @finish="OnFinish"
              />{{ reg }}</van-button
            >
          </template>
        </van-field>

        <div class="Submit_btn">
          <van-button
            block
            type="info"
            color="#9ebaea"
            native-type="submit"
            @click="onSubmit"
            >注册</van-button
          >
        </div>
      </van-form>
    </div>
    <div class="Fr_area">
      <span class="forget_pas">忘记密码</span>
    </div>
    <div class="tableTitle">
      <span class="midText">第三方登录</span>
    </div>
    <div class="third_party">
      <p>
        <svg-icon iconClass="qq" class="third_icon"></svg-icon>
        <span>QQ</span>
      </p>
      <p>
        <svg-icon iconClass="vx" class="third_icon"></svg-icon>
        <span>微信</span>
      </p>
      <p>
        <svg-icon iconClass="vb" class="third_icon"></svg-icon>
        <span>微博</span>
      </p>
    </div>
    <div class="copyright_footer">@最终版权归直播电商所有</div>
  </div>
</template>

<script>
import { Toast } from "vant";
import SvgIcon from "../../components/SvgIcon.vue";
export default {
  components: { SvgIcon },
  data() {
    //这里存放数据
    return {
      username: "",
      password: "",
      time: 60 * 100,
      reg: "发送验证码",
    };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    onSubmit() {
      Toast.success("注册成功");
      // this.$router.push("/layout/home");
    },
    login() {
      console.log("提交表单");
      this.$router.push("/layout/home");
    },

    Resend() {
      // console.log(this.$refs.CountDown);
      this.reg = "";
      this.$refs.CountDown.start();
      this.resend = "后" + this.resend;
      this.$refs.CountDown.$el.style.display = "block";
      // console.log(this.$refs.afresh);
      setTimeout(() => {
        alert("您的验证码为336721");
      }, 3000);
    },
    OnFinish() {
      this.reg = "发送验证码";

      this.$refs.CountDown.reset();
      this.$refs.CountDown.pause();
      this.$refs.CountDown.$el.style.display = "none";

      this.resend = "重新发送";
    },
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {},
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
};
</script>
<style lang="scss" scoped>
@import "@css/style.scss";
.register {
  width: 100%;
  height: 100%;
  .Jump_div {
    height: px2rem(40);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    .Jump_span {
      font-size: $infoSize;
      color: #b0b0b0;
      margin-right: px2rem(15);
      font-weight: bold;
    }
  }
  .Come_use {
    width: 100%;
    height: px2rem(130);
    text-align: center;
    line-height: px2rem(130);
    h2 {
      font-size: px2rem(17);
      font-weight: bolder;
      text-align: center;
      margin-bottom: px2rem(36);
    }
  }
  .input_item {
    width: 100%;
    height: px2rem(200);
    padding: 0 px2rem(16);
    .input_title {
      font-size: px2rem(14);
      margin: 0 px2rem(15);
      margin-top: px2rem(5);
    }
    .van-field__control {
      position: absolute;
    }
    .V_btn {
      position: relative;
      bottom: 0;
      width: px2rem(70);
      height: px2rem(30);
      font-size: px2rem(15);
      background: #ccc;
      display: inline-block;
      line-height: px2rem(30);
      text-align: center;
    }
    .Submit_btn {
      margin: 40px 14px 0 14px;
    }
  }
  .Fr_area {
    width: 100%;
    height: px2rem(30);
    margin-top: px2rem(15);
    padding: 0 px2rem(30);
    display: flex;
    align-items: center;
    justify-content: space-between;
    .forget_pas,
    .regist_user {
      font-size: px2rem(15);
      color: #ababab;
    }
    .regist_user {
      color: red;
    }
  }
  .tableTitle {
    position: relative;
    margin: px2rem(45) auto;
    width: 260px;
    height: 1px;
    background-color: #d4d4d4;
    text-align: center;
    font-size: 16px;
    color: rgba(101, 101, 101, 1);
    .midText {
      position: absolute;
      left: 50%;
      background-color: #ffffff;
      font-size: px2rem(14);
      padding: 0 15px;
      transform: translateX(-50%) translateY(-50%);
    }
  }
  .third_party {
    width: px2rem(170);
    height: px2rem(65);
    display: flex;
    margin: 0 auto;
    p {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-around;
      .third_icon {
        font-size: px2rem(30);
      }
      span {
        font-size: px2rem(14);
        color: #838383;
        font-weight: bolder;
      }
    }
  }
  .copyright_footer {
    width: 100%;
    height: px2rem(20);
    text-align: center;
    line-height: px2rem(20);
    font-size: px2rem(8);
    color: #c0c0c0;
    position: absolute;
    bottom: px2rem(10);
    left: px2rem(0);
  }
  @import "@css/style.scss";
  .register {
    width: 100%;
    height: 100%;
    .Jump_div {
      height: px2rem(40);
      display: flex;
      align-items: center;
      justify-content: flex-end;
      position: relative;
      .Jump_span {
        font-size: $infoSize;
        color: #b0b0b0;
        margin-right: px2rem(15);
        font-weight: bold;
      }
    }
    .Come_use {
      width: 100%;
      height: px2rem(130);
      text-align: center;
      line-height: px2rem(130);
      h2 {
        font-size: px2rem(17);
        font-weight: bolder;
        text-align: center;
        margin-bottom: px2rem(36);
      }
    }
    .input_item {
      width: 100%;
      height: px2rem(200);
      padding: 0 px2rem(16);
      .input_title {
        font-size: px2rem(14);
        margin: 0 px2rem(15);
        margin-top: px2rem(5);
      }
      .van-field__control {
        position: absolute;
      }
      .V_btn {
        position: relative;
        bottom: 0;
        width: px2rem(70);
        height: px2rem(30);
        font-size: px2rem(15);
        background: #ccc;
        display: inline-block;
        line-height: px2rem(30);
        text-align: center;
      }
      .Submit_btn {
        margin: 40px 14px 0 14px;
      }
    }
    .Fr_area {
      width: 100%;
      height: px2rem(30);
      margin-top: px2rem(15);
      padding: 0 px2rem(30);
      display: flex;
      align-items: center;
      justify-content: space-between;
      .forget_pas,
      .regist_user {
        font-size: px2rem(15);
        color: #ababab;
      }
      .regist_user {
        color: red;
      }
    }
    .tableTitle {
      position: relative;
      margin: px2rem(45) auto;
      width: 260px;
      height: 1px;
      background-color: #d4d4d4;
      text-align: center;
      font-size: 16px;
      color: rgba(101, 101, 101, 1);
      .midText {
        position: absolute;
        left: 50%;
        background-color: #ffffff;
        font-size: px2rem(14);
        padding: 0 15px;
        transform: translateX(-50%) translateY(-50%);
      }
    }
    .third_party {
      width: px2rem(170);
      height: px2rem(65);
      display: flex;
      margin: 0 auto;
      p {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-around;
        .third_icon {
          font-size: px2rem(30);
        }
        span {
          font-size: px2rem(14);
          color: #838383;
          font-weight: bolder;
        }
      }
    }
    .copyright_footer {
      width: 100%;
      height: px2rem(20);
      text-align: center;
      line-height: px2rem(20);
      font-size: px2rem(8);
      color: #c0c0c0;
      position: absolute;
      bottom: px2rem(10);
      left: px2rem(0);
    }
    @import "@css/style.scss";
    .register {
      width: 100%;
      height: 100%;
      .Jump_div {
        height: px2rem(40);
        display: flex;
        align-items: center;
        justify-content: flex-end;
        position: relative;
        .Jump_span {
          font-size: $infoSize;
          color: #b0b0b0;
          margin-right: px2rem(15);
          font-weight: bold;
        }
      }
      .Come_use {
        width: 100%;
        height: px2rem(130);
        text-align: center;
        line-height: px2rem(130);
        h2 {
          font-size: px2rem(17);
          font-weight: bolder;
          text-align: center;
          margin-bottom: px2rem(36);
        }
      }
      .input_item {
        width: 100%;
        height: px2rem(200);
        padding: 0 px2rem(16);
        .input_title {
          font-size: px2rem(14);
          margin: 0 px2rem(15);
          margin-top: px2rem(5);
        }
        .van-field__control {
          position: absolute;
        }
        .V_btn {
          position: relative;
          bottom: 0;
          width: px2rem(70);
          height: px2rem(30);
          font-size: px2rem(15);
          background: #ccc;
          display: inline-block;
          line-height: px2rem(30);
          text-align: center;
        }
        .Submit_btn {
          margin: 40px 14px 0 14px;
        }
      }
      .Fr_area {
        width: 100%;
        height: px2rem(30);
        margin-top: px2rem(15);
        padding: 0 px2rem(30);
        display: flex;
        align-items: center;
        justify-content: space-between;
        .forget_pas,
        .regist_user {
          font-size: px2rem(15);
          color: #ababab;
        }
        .regist_user {
          color: red;
        }
      }
      .tableTitle {
        position: relative;
        margin: px2rem(45) auto;
        width: 260px;
        height: 1px;
        background-color: #d4d4d4;
        text-align: center;
        font-size: 16px;
        color: rgba(101, 101, 101, 1);
        .midText {
          position: absolute;
          left: 50%;
          background-color: #ffffff;
          font-size: px2rem(14);
          padding: 0 15px;
          transform: translateX(-50%) translateY(-50%);
        }
      }
      .third_party {
        width: px2rem(170);
        height: px2rem(65);
        display: flex;
        margin: 0 auto;
        p {
          flex: 1;
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: space-around;
          .third_icon {
            font-size: px2rem(30);
          }
          span {
            font-size: px2rem(14);
            color: #838383;
            font-weight: bolder;
          }
        }
      }
      .copyright_footer {
        width: 100%;
        height: px2rem(20);
        text-align: center;
        line-height: px2rem(20);
        font-size: px2rem(8);
        color: #c0c0c0;
        position: absolute;
        bottom: px2rem(10);
        left: px2rem(0);
      }
      @import "@css/style.scss";
      .register {
        width: 100%;
        height: 100%;
        .Jump_div {
          height: px2rem(40);
          display: flex;
          align-items: center;
          justify-content: flex-end;
          position: relative;
          .Jump_span {
            font-size: $infoSize;
            color: #b0b0b0;
            margin-right: px2rem(15);
            font-weight: bold;
          }
        }
        .Come_use {
          width: 100%;
          height: px2rem(130);
          text-align: center;
          line-height: px2rem(130);
          h2 {
            font-size: px2rem(17);
            font-weight: bolder;
            text-align: center;
            margin-bottom: px2rem(36);
          }
        }
        .input_item {
          width: 100%;
          height: px2rem(200);
          padding: 0 px2rem(16);
          .input_title {
            font-size: px2rem(14);
            margin: 0 px2rem(15);
            margin-top: px2rem(5);
          }
          .van-field__control {
            position: absolute;
          }
          .V_btn {
            position: relative;
            bottom: 0;
            width: px2rem(70);
            height: px2rem(30);
            font-size: px2rem(15);
            background: #ccc;
            display: inline-block;
            line-height: px2rem(30);
            text-align: center;
          }
          .Submit_btn {
            margin: 40px 14px 0 14px;
          }
        }
        .Fr_area {
          width: 100%;
          height: px2rem(30);
          margin-top: px2rem(15);
          padding: 0 px2rem(30);
          display: flex;
          align-items: center;
          justify-content: space-between;
          .forget_pas,
          .regist_user {
            font-size: px2rem(15);
            color: #ababab;
          }
          .regist_user {
            color: red;
          }
        }
        .tableTitle {
          position: relative;
          margin: px2rem(45) auto;
          width: 260px;
          height: 1px;
          background-color: #d4d4d4;
          text-align: center;
          font-size: 16px;
          color: rgba(101, 101, 101, 1);
          .midText {
            position: absolute;
            left: 50%;
            background-color: #ffffff;
            font-size: px2rem(14);
            padding: 0 15px;
            transform: translateX(-50%) translateY(-50%);
          }
        }
        .third_party {
          width: px2rem(170);
          height: px2rem(65);
          display: flex;
          margin: 0 auto;
          p {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: space-around;
            .third_icon {
              font-size: px2rem(30);
            }
            span {
              font-size: px2rem(14);
              color: #838383;
              font-weight: bolder;
            }
          }
        }
        .copyright_footer {
          width: 100%;
          height: px2rem(20);
          text-align: center;
          line-height: px2rem(20);
          font-size: px2rem(8);
          color: #c0c0c0;
          position: absolute;
          bottom: px2rem(10);
          left: px2rem(0);
        }

        // 倒计时字体颜色 、
        .van-count-down {
          color: #fff;
        }
      }
      .van-count-down {
        color: #fff;
      }
    }
    .van-count-down {
      color: #fff;
    }
  }
  .van-count-down {
    color: #fff;
  }
}
</style>
